package com.acme.bankapp.domain.bank;

import java.util.Date;
import java.util.LinkedList;

import com.acme.bankapp.listeners.ClientRegistrationListener;

public class Bank {
	private int i;
	private Client masclient[] = new Client[10];
	private LinkedList<ClientRegistrationListener> listenerlist = new LinkedList<ClientRegistrationListener>();

	public void addclient(Client cl) {
		masclient[i] = cl;
		i++;
		for (ClientRegistrationListener tcl : listenerlist) {
			tcl.onClientAdded(cl);
		}
	}

	class DebugListener implements ClientRegistrationListener {

		@Override
		public void onClientAdded(Client c) {
			Date dat = new Date();
			System.out.println(c);
			System.out.println(dat);
		}

	}

	public Client[] getClients() {
		return masclient;
	}

	public Client getClient(int i) {
		return masclient[i];
	}

	public void addListener(ClientRegistrationListener cl) {
		listenerlist.add(cl);
	}

	public Bank() {
		listenerlist.add(new DebugListener());
	}
}
